filechooser: Get the filechooser tests to build
authorFederico Mena Quintero <federico@gnome.org>
Mon, 11 Feb 2013 19:38:58 +0000 (13:38 -0600)
committerFederico Mena Quintero <federico@gnome.org>
Thu, 14 Feb 2013 00:01:39 +0000 (18:01 -0600)
Some are ifdef-ed out with BROKEN_TESTS, but at least the tests will compile for now.

gtk/tests/Makefile.am
gtk/tests/filechooser.c

index d762a3544148de07a6406c0d84683223ee18d7b0..b28105d2b83d7f284e5a197f237b4d238405714a 100644 (file)
@@ -69,10 +69,9 @@ accel_LDADD                   = $(progs_ldadd)
 #crossingevents_SOURCES                 = crossingevents.c
 #crossingevents_LDADD           = $(progs_ldadd)
 
-# Should be ported to new API's
-#TEST_PROGS                    += filechooser
-#filechooser_SOURCES            = filechooser.c
-#filechooser_LDADD              = $(progs_ldadd)
+TEST_PROGS                     += filechooser
+filechooser_SOURCES             = filechooser.c
+filechooser_LDADD               = $(progs_ldadd)
 
 TEST_PROGS                     += builder
 builder_SOURCES                         = builder.c
index 7341e66863c396b255e0ca1f0ed38d4845540f6e..2537545b2adba275490eeb60dc2b8e631a9c28e3 100644 (file)
@@ -494,7 +494,7 @@ get_impl_from_dialog (GtkWidget *dialog)
 
   return impl;
 }
-
+#ifdef BROKEN_TESTS
 static gboolean
 test_widgets_for_current_action (GtkFileChooserDialog *dialog,
                                 GtkFileChooserAction  expected_action)
@@ -659,7 +659,9 @@ test_action_widgets (void)
 
   gtk_widget_destroy (dialog);
 }
+#endif
 
+#ifdef BROKEN_TESTS
 static gboolean
 test_reload_sequence (gboolean set_folder_before_map)
 {
@@ -815,6 +817,7 @@ test_reload (void)
   log_test (passed, "test_reload(): set a folder explicitly before mapping");
   g_assert (passed);
 }
+#endif
 
 static gboolean
 test_button_folder_states_for_action (GtkFileChooserAction action, gboolean use_dialog, gboolean set_folder_on_dialog)
@@ -985,8 +988,8 @@ test_folder_switch_and_filters (void)
   gboolean passed;
   char *cwd;
   char *base_dir;
-  GtkFilePath *cwd_path;
-  GtkFilePath *base_dir_path;
+  GFile *cwd_file;
+  GFile *base_dir_file;
   GtkWidget *dialog;
   GtkFileFilter *all_filter;
   GtkFileFilter *txt_filter;
@@ -1003,8 +1006,8 @@ test_folder_switch_and_filters (void)
                                        NULL);
   impl = get_impl_from_dialog (dialog);
 
-  cwd_path = gtk_file_system_filename_to_path (impl->file_system, cwd);
-  base_dir_path = gtk_file_system_filename_to_path (impl->file_system, base_dir);
+  cwd_file = g_file_new_for_path (cwd);
+  base_dir_file = g_file_new_for_path (base_dir);
 
   passed = passed && gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), base_dir);
   g_assert (passed);
@@ -1046,8 +1049,8 @@ test_folder_switch_and_filters (void)
   sleep_in_main_loop (0.25);
 
   g_signal_emit_by_name (impl->browse_path_bar, "path-clicked",
-                        (GtkFilePath *) cwd_path,
-                        (GtkFilePath *) base_dir_path,
+                        cwd_file,
+                        base_dir_file,
                         FALSE);
   sleep_in_main_loop (0.25);
   passed = passed && (gtk_file_chooser_get_filter (GTK_FILE_CHOOSER (dialog)) == txt_filter);
@@ -1057,8 +1060,8 @@ test_folder_switch_and_filters (void)
   /* cleanups */
   g_free (cwd);
   g_free (base_dir);
-  gtk_file_path_free (cwd_path);
-  gtk_file_path_free (base_dir_path);
+  g_object_unref (cwd_file);
+  g_object_unref (base_dir_file);
 
   gtk_widget_destroy (dialog);
 
@@ -1075,8 +1078,12 @@ main (int    argc,
   /* register tests */
   g_test_add_func ("/GtkFileChooser/black_box", test_black_box);
   g_test_add_func ("/GtkFileChooser/confirm_overwrite", test_confirm_overwrite);
+#ifdef BROKEN_TESTS
   g_test_add_func ("/GtkFileChooser/action_widgets", test_action_widgets);
+#endif
+#ifdef BROKEN_TESTS
   g_test_add_func ("/GtkFileChooser/reload", test_reload);
+#endif
   g_test_add_func ("/GtkFileChooser/button_folder_states", test_button_folder_states);
   g_test_add_func ("/GtkFileChooser/folder_switch_and_filters", test_folder_switch_and_filters);